home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / Obrn-A_1.6_lib.lha / oberon-a / source3.lha / source / Obsolete / HookUtil.mod < prev    next >
Text File  |  1995-06-29  |  2KB  |  68 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: HookUtil.mod $
  4.   Description:
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/29 19:06:56 $
  10.  
  11.   Copyright © 1994, Frank Copeland.
  12.   This file is part of the Oberon-A Library.
  13.   See Oberon-A.doc for conditions of use and distribution.
  14.  
  15. *************************************************************************)
  16.  
  17. <* STANDARD- *>
  18.  
  19. MODULE HookUtil;
  20.  
  21. IMPORT SYS := SYSTEM, e := Exec, u := Utility;
  22.  
  23. (*------------------------------------*)
  24. (*
  25.   This procedure is intended to be installed in the entry field of a
  26.   u.Hook record.  Its purpose is to push the parameters passed to it
  27.   onto the stack and call the procedure installed in the subEntry field.
  28.  
  29.   The parameters are:
  30.  
  31.     hook    : u.HookPtr; (* passed in the A0 register *)
  32.     object  : e.APTR;    (* passed in the A2 register *)
  33.     message : e.APTR;    (* passed in the A1 register *)
  34.  
  35.   Stack checking should be turned off (<*$StackChk-*>) in all procedures
  36.   installed in Hooks, as they are likely to be running in a non-Oberon
  37.   context.
  38. *)
  39.  
  40. PROCEDURE HookEntry* () : e.APTR;
  41.  
  42. <*$EntryExitCode-*>
  43. BEGIN (* HookEntry *)
  44.   SYS.INLINE (
  45.     2F08H,                       (* MOVE.L A0, -(A7)      *)
  46.     2F0AH,                       (* MOVE.L A2, -(A7)      *)
  47.     2F09H,                       (* MOVE.L A1, -(A7)      *)
  48.     2068H, 000CH,                (* MOVE.L  000C(A0), A0  *)
  49.     4E90H,                       (* JSR    (A0)           *)
  50.     4E75H )                      (* RTS                   *)
  51.   (*
  52.     No RETURN is required, result is already in D0.
  53.     The procedure in subEntry will clean up the parameters on the stack.
  54.   *)
  55. END HookEntry;
  56.  
  57. (*------------------------------------*)
  58. PROCEDURE InitHook *
  59.   (VAR hook : u.Hook; subEntry : u.HookFunc; data : e.APTR);
  60.  
  61. BEGIN (* InitHook *)
  62.   hook.entry := HookEntry;
  63.   hook.subEntry := subEntry;
  64.   hook.data := data;
  65. END InitHook;
  66.  
  67. END HookUtil.
  68.